package com.shell.governor.modules.service.impl;

import com.shell.bee.base.utils.StringUtil;
import com.shell.bee.persistence.service.impl.PersistentServiceImpl;
import com.shell.governor.modules.po.PubBizRes;
import com.shell.governor.modules.service.PubBizResService;
import org.springframework.stereotype.Service;

@Service
public class PubBizResServiceImpl extends PersistentServiceImpl<PubBizRes> implements PubBizResService {
	public void saveBizs(String bizId, String roleId, String resIds) {
		PubBizRes bizRes = new PubBizRes();
		bizRes.setBizId(bizId);
		bizRes.setRoleId(roleId);
		deleteEntity(bizRes);
		if (StringUtil.notEmpty(resIds)) {
			String[] resIdArr = resIds.split(",");
			for (String resId : resIdArr) {
				PubBizRes res = new PubBizRes();
				res.setBizId(bizId);
				res.setRoleId(roleId);
				res.setResId(resId);
				save(res);
			}
		}
	}
}
